//-----------------------------------------------------------------------
// <copyright file="DanhMucServiceBase.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using Pyco;
using Pyco.Diagnostics;
using Pyco.Data;
using APPro.Entities;
using APPro.Data;
    
namespace APPro.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class DanhMucServiceBase
    {
        #region DanhMucServiceBase

        public static void CreateDanhMuc(DanhMuc danhMuc)
        {            
            try
            {
                DanhMucDAO danhMucDAO = new DanhMucDAO();
                danhMucDAO.CreateDanhMuc(danhMuc);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessCreateDanhMucException, ex);
            }
        }

        public static void UpdateDanhMuc(DanhMuc danhMuc)
        {            
            try
            {
                DanhMucDAO danhMucDAO = new DanhMucDAO();
                danhMucDAO.UpdateDanhMuc(danhMuc);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessUpdateDanhMucException, ex);
            }
        }        

        public static void DeleteDanhMuc(int maDanhMuc)
        {            
            try
            {
                DanhMucDAO danhMucDAO = new DanhMucDAO();
                danhMucDAO.DeleteDanhMuc(maDanhMuc);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessDeleteDanhMucException, ex);
            }
        }
		
        public static DanhMuc GetDanhMuc(int maDanhMuc)
        {            
            try
            {
                DanhMucDAO danhMucDAO = new DanhMucDAO();
                return danhMucDAO.GetDanhMuc(maDanhMuc);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetDanhMucException, ex);
            }
        }                
		
        public static DanhMucCollection GetDanhMucList(DanhMucColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                DanhMucDAO danhMucDAO = new DanhMucDAO();
                return danhMucDAO.GetDanhMucList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetDanhMucListException, ex);
            }
        }        

        public static DanhMucCollection GetDanhMucList(DanhMucColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                DanhMucDAO danhMucDAO = new DanhMucDAO();
                return danhMucDAO.GetDanhMucList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetDanhMucListException, ex);
            }
        }        
		
		
        #endregion
    }
}